package com.projects.api.common.base;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * @author zhangzhenfu
 * @Description
 * @date 2020/4/3 15:16
 */
@ApiModel
public abstract class BaseResult<D> implements Serializable {

    /**
     * 状态码
     */
    @ApiModelProperty(value = "状态码")
    private int code;

    /**
     * 成功标识
     */
    @ApiModelProperty(value = "成功标识，true or false")
    private boolean success;

    /**
     * 成功为success，其他为失败原因
     */
    @ApiModelProperty(value = "提示信息")
    private String message;

    public BaseResult() {
    }

    public BaseResult(int code, String message) {
        this.code = code;
        this.message = message;
        this.success = true;
    }

    public BaseResult(int code, boolean success, String message) {
        this.code = code;
        this.message = message;
        this.success = success;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }
}

